﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Product.Master" Inherits="System.Web.Mvc.ViewPage<GuestBookViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <hr style="border: none; margin-top: 0px; padding-top: 0px; margin-bottom: 0px; border-bottom: 4px solid #A7CBFF;" />
    <div class="textRight" style="margin: 5px 0;">
        <input type="button" name="btnadd" value="<%=ViewsResources.Shared.GBNew %>" /><br />
    </div>
    <div class="gb_box">
        <ul>
            <% foreach (EGuestBook item in Model.GuestBookList) { %>
            <li>
                <div class="gb_title">
                    <%=item.NickName %>
                    -
                    <%=item.Email %>
                    -
                    <%=item.AddDate %>
                </div>
                <div class="gb_content">
                    <%=item.Content %>
                    <% if (!string.IsNullOrEmpty(item.ReContent)) { %>
                    <div class="gb_re">
                        管理员回复:
                        <br />
                        <%=item.ReContent %>
                    </div>
                    <% } %>
                </div>
            </li>
            <% } %>
        </ul>
    </div>
    <div class="divPager2">
        <%= Html.Pager(ViewData["Pager"]) %>
    </div>
    <div class="gb_add">
        <% using (Html.BeginForm("Edit", "GuestBook", FormMethod.Post)) { %>
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td class="t">
                    <%=ViewsResources.Shared.GBNickname%>
                </td>
                <td>
                    <%=Html.TextBoxFor(m => m.GuestBookInfo.NickName)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%=ViewsResources.Shared.GBEmail%>
                </td>
                <td>
                    <%=Html.TextBoxFor(m => m.GuestBookInfo.Email)%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <%=Html.TextAreaFor(m => m.GuestBookInfo.Content)%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" name="btnsumbit" value="<%=ViewsResources.Shared.Submit %>" />
                    <input type="reset" name="btnreset" value="<%=ViewsResources.Shared.Reset %>" />
                </td>
            </tr>
        </table>
        <% } %>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <%= HtmlMetaHelper.HtmlTitle(ViewsResources.Shared.Guestbook)%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
    <style type="text/css">
        .gb_box
        {
            border: solid 2px #e5e5e5;
            border-bottom: none;
            margin-bottom: 10px;
        }
        .gb_box ul li
        {
            border-bottom: 2px solid #e5e5e5;
            padding: 15px;
        }
        .gb_title
        {
            font-family: Georgia;
            font-size: 14px;
            padding: 5px;
            border-bottom: 1px dotted #ccc;
        }
        .gb_content
        {
            padding: 10px;
            line-height: 2em;
        }
        .gb_alter
        {
            background-color: #f7f7f7;
        }
        .gb_re
        {
            padding: 10px;
            line-height: 2em;
            color: Red;
            border: 1px solid #ccc;
        }
        .gb_add table
        {
            width: 500px;
        }
        .gb_add table td
        {
            padding: 5px;
        }
        .gb_add table td.t
        {
            width: 50px;
        }
        .gb_add table td textarea
        {
            width: 100%;
            height: 150px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $("div.gb_box ul li:odd").addClass("gb_alter");
            $("div.gb_add").dialog({ autoOpen: false,
                title: "<%=ViewsResources.Shared.Guestbook %>",
                width: 520, height: 320, closeText: "X", modal: true
            });
            $(":button[name='btnadd']").click(function () { $("div.gb_add").dialog("open"); });
            $("form").submit(function () {
                var flag = true;
                $("textarea,input").each(function () { if ($(this).val() == "") { $(this).focus(); flag = false; } });
                return flag;
            });
        });
    </script>
</asp:Content>
